<?php
    header("Content-type: text/html; charset=utf-8");
$localhost = 'localhost';
$usernamesql = 'root';
$passwordsql = 'root';
$conn = mysqli_connect($localhost, $usernamesql, $passwordsql);
//应用数据库
$query='use bigmelon';
mysqli_query($conn,$query);
$lfm= $_GET['lfm'];
if($lfm=='captcha'){
    $tel=$_GET['tel'];
    $query="select tel_active from melon where tel='$tel'";
    $res=mysqli_query($conn,$query);
    $res=mysqli_fetch_array($res);
    if(!$res){
        die('0');//手机号未注册
    }
    else {

        die("$res[tel_active]");
    }

}
elseif($lfm=='login'){
    $tel=$_GET['tel'];
    $password=$_GET['password'];
    $telActive=$_GET['telActive'];
    $query="select * from melon where tel ='$tel'";
    $res=mysqli_query($conn,$query);
    while($row = mysqli_fetch_array($res)){
        // die("$row[password],$password");
        if($row['password']==$password){
            die("$row[username]");

        } else {
            die('0');
        }
    }
   
}

?>